import Taro, { Component } from '@tarojs/taro'
import Index from './pages/index'
import './app.scss'

class App extends Component {

  config = {
    pages: [
      'pages/index/index',
      'pages/user/index',
      'pages/user/currentdetail/index',
      'pages/user/notify/index',
      'pages/index/detail/index',
      'pages/publish/index',
    ],
    cloud: true,
    window: {
      navigationBarTextStyle: "black",
      navigationStyle: "custom"
    },
    permission: {
      'scope.userLocation': {
        desc: '我们将根据您的位置信息，给您推荐距离最近的约拍动态和服务'
      }
    },
    tabBar: {
      list: [
        {
          text: '首页',
          pagePath: "pages/index/index",
          iconPath: "./image/icon_component.png",
          selectedIconPath: "./image/icon_component_HL.png",
          tagType: 'text',
          selectedColor: 'red'
        },
        {
          text: '发布',
          pagePath: "pages/publish/index",
          iconPath: "./image/icon_component.png",
          selectedIconPath: "./image/icon_component.png",
          tagType: 'font',
          selectedColor: 'red'
        },
        {
          text: '个人中心',
          pagePath: "pages/user/index",
          iconPath: "./image/icon_component.png",
          selectedIconPath: "./image/icon_component.png",
          tagType: 'text',
          selectedColor: 'red'
        },
      ],
      custom: true
    }
  }

  componentDidMount () {
    if (process.env.TARO_ENV === 'weapp') {
      Taro.cloud.init({
        env: 'sanfou-database-32g1q',
        traceUser: true
      })
    }
  }

  componentDidShow () {}

  componentDidHide () {}

  componentDidCatchError () {}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render () {
    return (
      <Index />
    )
  }
}

Taro.render(<App />, document.getElementById('app'))
